<template>
  <div id="integDetail">
    <!-- 这是个人积分 -->
    <el-container>
      <el-header><Header></Header></el-header>
      <el-main>
        <div class="integ">
          <div class="integ_title">
            <p>
              <span>{{ $t("integhome.integtitle") }}</span>
            </p>
          </div>
          <div class="integ_content">
            <div class="integ_one">
              <div class="integ_logo">
                <img v-if="imageUrl" :src="imageUrl" alt="" />
              </div>
              <div class="home_info">
                <div class="integ_name">姓名：{{ userInfo.realname || "未定义名字" }}</div>
                <div class="integ_details">个人积分：{{userInfo.credit1 || "0"}}分</div>
              </div>
              <div class="exchange"><router-link to="/pointsExchange">立即兑换</router-link></div>
            </div>
            <div class="integ_two">
              <div class="two_title">
                <span>{{ $t("integhome.integgoing") }}</span>
              </div>
              <el-table
                ref="singleTable"
                :data="tableData"
                highlight-current-row
                style="width: 100%"
              >
                <el-table-column type="index" width="50"> </el-table-column>
                <el-table-column property="date" label="日期" width="120">
                </el-table-column>
                <el-table-column property="name" label="积分明细" width="120">
                </el-table-column>
                <el-table-column property="address" label="详情">
                </el-table-column>
              </el-table>
            </div>
          </div>
        </div>
      </el-main>
      <el-footer><Footer></Footer></el-footer>
    </el-container>
  </div>
</template>

<script>
import Header from "@/components/Header.vue";
import Footer from "@/components/Footer.vue";
export default {
  data() {
    return {
      userInfo: {
        nickname: "", // 名称
        headimgurl: "", // 头像
        credit1: "" //积分
      },
      imageUrl: "", // 头像

      tableData: [
        {
          date: "2016-05-02",
          name: "10",
          address: "购物名称或者某某用处",
        },
        {
          date: "2016-05-02",
          name: "10",
          address: "购物名称或者某某用处",
        },
        {
          date: "2016-05-02",
          name: "10",
          address: "购物名称或者某某用处",
        },
        {
          date: "2016-05-02",
          name: "10",
          address: "购物名称或者某某用处",
        },
        {
          date: "2016-05-02",
          name: "10",
          address: "购物名称或者某某用处",
        },
        {
          date: "2016-05-02",
          name: "10",
          address: "购物名称或者某某用处",
        },
        {
          date: "2016-05-02",
          name: "10",
          address: "购物名称或者某某用处",
        },
        {
          date: "2016-05-02",
          name: "10",
          address: "购物名称或者某某用处",
        },
      ],
      currentRow: null,
    };
  },
  components: {
    Header,
    Footer,
  },
  methods: {},
  created() {
    var _this = this;
    let id = _this.$Cookie.getCookie("userID");
    if (_this.$Cookie.getCookie("token") != undefined) {
      _this.$get(`user/info/${id}`).then((res) => {
        if (res.code == 200) {
          _this.userInfo = res.data;
          _this.imageUrl = res.data.avatar;
        }
      });
    } else {
      // 没token值
      _this.$MessageAlert(true, _this.$t("share.Message.login"), "error");
      _this.$router.push({ path: "/" });
    }

  },
};
</script>

<style lang="less" scoped>
// 布局容器
.el-header {
  font-size: 0;
}
.el-header,
.el-footer {
  color: #333;
  text-align: center;
  height: auto !important;
  padding: 0px;
}
.el-main {
  color: #333;
  padding: 0px;
  // 计算减去头部和底部的高度，就是中间的高度
  min-height: calc(100vh - 61px - 220px);
}
.el-aside {
  color: #333;
  text-align: center;
}
// 布局容器结束
#userDetail {
  min-width: 650px;
}
.integ {
  width: 600px;
  margin: auto;
  padding: 40px;
  .integ_title {
    span {
      display: inline-block;
      padding-bottom: 5px;
      border-bottom: 2px solid #e2231a;
      color: #999;
    }
  }
  .integ_content {
    margin-top: 20px;
    .integ_one {
      width: 600px;
      height: 100px;
      border: 1px solid #999;
      border-radius: 5px;
      position: relative;
      .integ_logo {
        float: left;
        width: 70px;
        height: 70px;
        border-radius: 5px;
        margin: 15px;
      }
      .home_info {
        float: left;
        margin: 15px 0;
        .integ_name {
          font-size: 18px;
          color: #999;
          margin-bottom: 20px;
        }
        .integ_details {
          font-size: 18px;
          color: #999;
        }
      }
      .exchange {
        position: absolute;
        right: 0;
        width: 70px;
        height: 70px;
        border: 1px solid #999;
        border-radius: 5px;
        text-align: center;
        line-height: 70px;
        margin: 15px 10px;
        cursor: pointer;
      }
      .exchange:hover {
        background: #8c939d;
        color: #fff;
      }
    }
    .integ_two {
      width: 600px;
      height: auto;
      position: relative;
      .two_title {
        float: left;
        text-align: left;
        width: 600px;
        margin-top: 20px;
        span {
          display: inline-block;
          padding-bottom: 5px;
          border-bottom: 2px solid #e2231a;
          color: #999;
          font-size: 16px;
        }
      }
    }
  }
}
/deep/ .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader {
  text-align: center;
}
// .avatar-uploader .el-upload:hover {
//     border-color: #409EFF;
// }
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 80px;
  height: 80px;
  line-height: 80px;
  text-align: center;
}
.avatar {
  width: 80px;
  height: 80px;
  display: block;
}
/deep/ .el-upload__input {
  display: none;
}
// 地区选择器
/deep/ .distpicker-address-wrapper select {
  font-size: 1.3rem;
}
// /deep/ .avatar-uploader-icon {
//     border: 1px dashed red;
// }
</style>